<?php
include_once('common/header.php');	
if($AppUI->id <= 0 || !isset($_SERVER['HTTP_REFERER'])) {	
	$arrJson = array('error'=>1,'msg'=>$arrError[1]);
	echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
	exit();
}
$intHexId		= $objRequest->getParam('uid',0);
$objVfriendUser	= new Vfriend_User();
$objUser		= $objVfriendUser->getInfoByHexUserId($intHexId);
$friendOfUser	= null;
if($objUser) {
	$friendOfUser	= $objVfriendUser->getRelation($objUser->id, 3);
}
$friendOfApp	= $objVfriendUser->getRelation($AppUI->id, 2);
$arrResult		= array();
if(isset($friendOfUser) && $friendOfUser && isset($friendOfApp) && $friendOfApp) {
	foreach($friendOfUser as $value) {		
		if(isset($value['targetid']) && isset($friendOfApp[$value['targetid']]) && $value['targetid'] == $friendOfApp[$value['targetid']]) {
			$arrResult[]['targetid'] = $value['targetid'];
		}
	}
}
$this->view->arrResult	= $arrResult;
$objView 		= Zend_Registry::get('objView');
$strData		= $objView->fetch('ajax/ui-friend.tpl');
$arrJson 		= array('error'=>0,'msg'=>$strData);
echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
exit();
?>